/* GUI CONVERTED from sopirp01.p (converter v1.75) Sat Aug 12 17:26:42 2000 */
/* sopirp01.p - SALES ORDER PRICING REPORT SELECTION CRITERIA           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* web convert sopirp01.p (converter v1.00) Fri Oct 10 13:57:21 1997 */
/* web tag in sopirp01.p (converter v1.00) Mon Oct 06 14:17:48 1997 */
/*F0PN*/ /*K0W7*/ /*                                                    */
/*V8:ConvertMode=FullGUIReport                                 */
/* REVISION: 7.5      LAST MODIFIED: 02/01/95   BY: tjm *J042*          */
/* REVISION: 8.5      LAST MODIFIED: 01/23/96   BY: jpm *J0C6*          */
/* REVISION: 8.6      LAST MODIFIED: 10/13/97   BY: gyk *K0W7*          */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KN* myb              */


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

     {mfdtitle.i "b+ "}

     define new shared variable sonbr        like so_nbr.
     define new shared variable sonbr1       like so_nbr.
     define new shared variable socust       like so_cust.
     define new shared variable socust1      like so_cust.
     define new shared variable sobill       like so_bill.
     define new shared variable sobill1      like so_bill.
     define new shared variable soship       like so_ship.
     define new shared variable soship1      like so_ship.
     define new shared variable soorddate    like so_ord_date.
     define new shared variable soorddate1   like so_ord_date.
     define new shared variable soduedate    like sod_due_date.
     define new shared variable soduedate1   like sod_due_date.
     define new shared variable soprdate     like so_priced_dt.
     define new shared variable soprdate1    like so_priced_dt.

         define variable qty_open        like sod_qty_ord .
/*J0XD*  define variable amt_type        like pih_amt_type. */
/*J0XD*  define variable source          like pih_source.   */
/*J0XD*/ define variable amt_type like pih_amt_type format "x(12)".
/*J0XD*/ define variable source   like pih_source   format "x(12)".
         define variable order_header    like mfc_logical.


     
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
        
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
        sonbr          colon 25
        sonbr1         colon 48 label {t001.i}
        socust         colon 25
        socust1        colon 48 label {t001.i}
        sobill         colon 25
        sobill1        colon 48 label {t001.i}
        soship         colon 25
        soship1        colon 48 label {t001.i}
        soprdate       colon 25
        soprdate1      colon 48 label {t001.i}
        soorddate      colon 25
        soorddate1     colon 48 label {t001.i}
        soduedate      colon 25
        soduedate1     colon 48 label {t001.i}
      SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



     /* SET EXTERNAL LABELS */
     setFrameLabels(frame a:handle).
/*K0W7*/ {wbrp01.i}
/*J0C6*/ /*V8+*/


/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

        if sonbr1 = hi_char then sonbr1 = "".
        if socust1 = hi_char then socust1 = "".
        if sobill1 = hi_char then sobill1 = "".
        if soship1 = hi_char then soship1 = "".
        if soprdate = low_date then soprdate = ?.
        if soprdate1 = hi_date then soprdate1 = ?.
        if soorddate = low_date then soorddate = ?.
        if soorddate1 = hi_date then soorddate1 = ?.
        if soduedate = low_date then soduedate = ?.
        if soduedate1 = hi_date then soduedate1 = ?.

        view frame a.

/*K0W7*/ if c-application-mode <> 'web' then
        
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K0W7*/ {wbrp06.i &command = update &fields = "  sonbr sonbr1 socust socust1
sobill sobill1 soship soship1 soprdate soprdate1 soorddate soorddate1 soduedate
soduedate1" &frm = "a"}

/*K0W7*/ if (c-application-mode <> 'web') or
/*K0W7*/ (c-application-mode = 'web' and
/*K0W7*/ (c-web-request begins 'data')) then do:

        bcdparm = "".
        {mfquoter.i sonbr}
        {mfquoter.i sonbr1}
        {mfquoter.i socust}
        {mfquoter.i socust1}
        {mfquoter.i sobill}
        {mfquoter.i sobill1}
        {mfquoter.i soship}
        {mfquoter.i soship1}
        {mfquoter.i soorddate}
        {mfquoter.i soorddate1}
        {mfquoter.i soprdate}
        {mfquoter.i soprdate1}
        {mfquoter.i soduedate}
        {mfquoter.i soduedate1}

        if sonbr1 = "" then sonbr1 = hi_char.
        if socust1 = "" then socust1 = hi_char.
        if sobill1 = "" then sobill1 = hi_char.
        if soship1 = "" then soship1 = hi_char.
        if soorddate1 = ? then soorddate1 = hi_date.
        if soorddate = ? then soorddate = low_date.
        if soprdate1 = ? then soprdate1 = hi_date.
        if soprdate = ? then soprdate = low_date.
        if soduedate1 = ? then soduedate1 = hi_date.
        if soduedate = ? then soduedate = low_date.

/*K0W7*/ end.
               /* SELECT PRINTER */
               
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:


        /*fdn*/ {hksimsg.i """" """"}

         {mfphead.i}

         for each so_mstr
            where so_nbr        >= sonbr     and so_nbr       <= sonbr1
              and so_cust       >= socust    and so_cust      <= socust1
              and so_bill       >= sobill    and so_bill      <= sobill1
              and so_ship       >= soship    and so_ship      <= soship1
              and so_priced_dt  >= soprdate  and so_priced_dt <= soprdate1
              and so_ord_date   >= soorddate and so_ord_date  <= soorddate1
             /*fdn*/ AND LOOKUP(so_site, global_user_site) > 0
/*J05K*/    no-lock:

            order_header = no.

            for each sod_det
               where sod_nbr = so_nbr
                 and ((sod_due_date >= soduedate
                        and sod_due_date <= soduedate1)
                     or  (soduedate = low_date and soduedate1 = hi_date
/*J05K*/                   and sod_due_date = ?)) no-lock:

               find first pt_mstr where pt_part = sod_part
                          no-lock no-error.

               /* PRINT HEADER */
               if not order_header then do:
                  find ad_mstr no-lock where ad_addr = so_cust.
                  order_header = yes.
                  if so_curr = base_curr then do with frame ax:
                     /* SET EXTERNAL LABELS */
                     setFrameLabels(frame ax:handle).
                     display sod_nbr so_cust ad_name so_bill so_ship
                        so_ord_date so_due_date so_priced_dt so_po
/*J11K                     with frame a width 132. */
/*J11K*/             with frame ax width 132 STREAM-IO /*GUI*/ .
                  end. /* if so_curr = base_curr then */
                  else  do with frame  b:
                     /* SET EXTERNAL LABELS */
                     setFrameLabels(frame b:handle).
             display sod_nbr so_cust ad_name so_bill so_ship
                        so_ord_date so_due_date so_priced_dt so_po
                        so_curr with frame b width 132 STREAM-IO /*GUI*/ .
                  end. /* else */
           end.

/*J0XD*/       qty_open = sod_qty_ord - sod_qty_ship.

/*J0XD*/       if available pt_mstr then do with frame c:
                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame c:handle).
                  /* PRINT DETAIL */
                  display
/*J0XD*              space(3) */
/*J0XD*/             space(2)
                     sod_line sod_part pt_break_cat qty_open
/*J0T0**             sod_list_pr sod_disc_pct sod_price sod_qty_ord */
/*J0XD* /*J0T0*/     sod_list_pr sod_disc_pct format "->>>9.99" sod_price */
/*J0XD*/             sod_list_pr format "->>>>,>>>,>>9.99<<<"
/*J0XD*/             sod_disc_pct format "->>>9.99"
/*J0XD*/             sod_price format "->>>>,>>>,>>9.99<<<"
/*J0T0*/             sod_qty_ord
                     sod_pricing_dt sod_due_date
                  with frame c width 132 no-attr-space down STREAM-IO /*GUI*/ .
               end. /* if available pt_mstr */

               for each pih_hist
/*J05K*/          no-lock
/*J063*/          where pih_doc_type = 1
                    and pih_nbr      = sod_nbr
                    and pih_line     = sod_line
                    AND pih_source   > ""
                  by pih_feature by pih_option by pih_amt_type
                  by pih_source with frame d:

                  find first lngd_det
                     where lngd_dataset = "pi_mstr"
                       and lngd_field   = "pi_amt_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pih_amt_type
                     no-lock no-error.

                  if lngd_mnemonic <> "" then
                      amt_type = lngd_mnemonic.
                  else
                      amt_type = lngd_translation.

                  find first lngd_det
                     where lngd_dataset = "pih_hist"
                       and lngd_field   = "pih_source"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pih_source
                     no-lock no-error.

                  if lngd_mnemonic <> "" then
                     source = lngd_mnemonic.
                  else
                     source = lngd_translation.

                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame d:handle).
                  display
/*J0XD*              space(6)  */
/*J0XD*/             space(2)
                     pih_list pih_qty pih_break_cat
                     amt_type source pih_amt pih_disc_amt pih_option
                     pih_confg_disc
                  with frame d width 132 no-attr-space down STREAM-IO /*GUI*/ .
               end. /* for each pih_hist */

            end. /* for each sod_det */

            
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/


         end. /* for each so_mstr */

        
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


     end.  /* repeat */

/*K0W7*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" sonbr sonbr1 socust socust1 sobill sobill1 soship soship1 soprdate soprdate1 soorddate soorddate1 soduedate soduedate1 "} /*Drive the Report*/
